package wrs.hcs.tc;

import org.openqa.selenium.WebDriver;
import wrs.hcs.functions.*;

public class WebApp_SingleWithGuarantor {

	public static WebDriver driver;
	public static String lName;
	public static String pin;
	
	public void transact() throws Exception
	{
		Webdriver d = new Webdriver();
		Login log = new Login();
		Logout out = new Logout();

		driver = d.startUp();
			
		Hcs_NewPatient newPatient = new Hcs_NewPatient();
		//Criteria for login in hcs: "admission", "nursing", "billing"
		log.hcs(driver, "admission"); 						//login

		String getIt = newPatient.createPatient(driver, "adult");	//new patient in hcs
		out.hcs(driver); 									//logout after getting pin and lastname
		
		
		//Split string for PIN and LASTNAME
		String[] arrString = getIt.split(",");
		lName = arrString[0];
		pin = arrString[1];
		
		WebApp_Single s = new WebApp_Single();
		s.wellness(driver, lName, pin, true, "basic"); 					//create wrs transaction in webapp for patient
		
		driver = d.startUp();
		log.admin(driver); //login
		AdminConsole_Single console = new AdminConsole_Single();
		console.admin(driver, pin, "inpatient");   						//update on admin and forward to hcs
		out.admin(driver);
		
		log.hcs(driver, "nursing");
		Hcs_Nursing pack = new Hcs_Nursing();
		pack.validate(driver, pin); 						//validate package of patient
		pack.discharge(driver, pin); 						//fill up discharge instructions
		pack.pf(driver, pin); 								//assign pf and discharge
		out.hcs(driver);
		
		//driver = d.startUp();
		log.hcs(driver, "billing"); 						//das discharge
		Hcs_Billing bill = new Hcs_Billing();
		bill.das(driver, pin); 
		out.hcs(driver);
	
		log.hcs(driver, "nursing"); 						//print gatepass
		pack.gatepass(driver, pin);
		
	}
	
}
